package com.zyk.scaffold.core.holder;

import com.zyk.scaffold.common.utils.OptionalPlus;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class EnvironmentHolder implements EnvironmentAware {
    private static volatile Environment environment = null;
    @Override
    public void setEnvironment(Environment environment) {
        EnvironmentHolder.environment = environment;
    }

    public static OptionalPlus<Environment> getEnvironment() {
        return OptionalPlus.ofNullable(environment);
    }
}
